package cn.coco.jf.fw.api.config;

import org.apache.log4j.Logger;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;



public class ApiInterceptor implements Interceptor{
    private static Logger _LOG = Logger.getLogger(ApiInterceptor.class);
    
    @Override
    public void intercept(Invocation inv) {
            try{
                inv.invoke();
            }catch(Exception e){
                _LOG.error("系统异常：", e);
                inv.getController().setAttr("code", 500);
                inv.getController().setAttr("msg", "系统异常");
                inv.getController().renderJson();
            }
        
    }

}
